<?php
/**
 * RedCross Application
 *
 * @copyright Copyright (c) 2010, Kristian Stokke Tryggestad, Rune Vikestad, Andreas Flaten Wist, Simen Nicolai Echholt, Ole Henrik Jahren
 */

/**
 * User register form
 *
 * @category    RedCross
 * @package     Core_Form
 */
class Core_Form_User_Register extends Core_Form_User_Base
{
    public function init()
    {
        parent::init();

        $this->getElement('username')->addValidator('UniqueUsername', true);
        $this->getElement('email')->addValidator('CanRegister', true);
        
        $this->setAttrib('id', 'user_register');

        $this->addElement('password', 'confirmPassword', array(
           'validators'     => array(
               array('NotEmpty', true),
               array('PasswordVerification', true),
            ),
            'required'      => true,
            'ignore'        => true,
            'label'         => 'Bekreft passord'
        ));

        $this->addElement('checkbox', 'is_public', array (
            'label' => 'Jeg godtar at navnet og telefonnummeret mitt er synlig for andre medlemmer.',
        ));
        $this->getElement('is_public')->setValue(1);
        $this->getElement('is_public')->getDecorator('Label')->setOption('placement', 'APPEND');
        $this->getElement('is_public')->getDecorator('HtmlTag')->setOption('class', 'is_public');

        /*$publicInfo = new Zend_Form_Element_Checkbox('is_public');
        $publicInfo->setLabel('Jeg godtar at medlemsinformasjonen min er synlig for andre medlemmer.');
        $this->addElement($publicInfo);*/

        $this->addElement('submit', 'submit', array(
            'required' => true,
            'ignore'   => true,
            'label'    => 'Lag konto',
        ));
    }
}
